package com.dudu.controller;


import com.alibaba.fastjson.JSONObject;
import com.dudu.domain.Building;
import com.dudu.domain.Room;
import com.dudu.domain.Roomtype;
import com.dudu.service.BuildingService;
import com.dudu.service.RoomService;
import com.dudu.service.RoomTypeService;
import com.dudu.tools.ServletUtil;
import com.dudu.tools.StringUtil;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import java.net.Inet4Address;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/** 教程页面
 * Created by tengj on 2017/3/13.
 */
@Controller
@RequestMapping("/text")
public class text {
    @Autowired
    private RoomService roomService;
	@Autowired
	RoomTypeService roomTypeService;
	@Autowired
	BuildingService buildingService;


    @RequestMapping(value = "/list", produces = "application/json; charset=utf-8")
    @ResponseBody
    public Map<String, List<Room>> roomList(){
        List<Room> roomList=roomService.getAllRoom();

        Map<String, List<Room>> map=new HashMap<>();
        map.put("roomlist", roomList);
        return map ;

    }
}